Apparatus for Encoding Moving Picture

ABSTRACT

Provided is an apparatus for encoding a moving picture that determines a quantization step size of a previous coding block according to scan order as the quantization step size predictor of the current coding block when a quantization step size of a left coding block of a current coding block and a quantization step size of an above coding block of the current coding block are unavailable and determines an available motion vector encountered first when retrieving motion vectors in the order of motion vector of a first predetermined position and motion vector of a second predetermined position in a reference picture as a temporal motion vector candidate. Therefore, it is possible to reduce the amount of coding bits required to encode motion information and the quantization step size of the current prediction block.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of U.S. application Ser.No. 13/624,864 filed on Sep. 21, 2012, which is a continuationapplication of International Application No. PCT/KR2011/005942 filed onAug. 12, 2011, which claims priority to Korean Application No.10-2010-0079530 filed on Aug. 17, 2010 and Korean Application No.10-2011-0064306 filed Jun. 30, 2011. The applications are incorporatedherein by reference.

TECHNICAL FIELD

The present invention relates to a method of encoding a moving picturein inter prediction mode, and more particularly, to a method of encodinga motion vector of a current prediction unit using one of motion vectorsof spatially and temporally neighboring prediction unit.

BACKGROUND ART

In image compression methods such as Motion Picture Experts Group(MPEG)-1, MPEG-2, MPEG-4 and H.264/MPEG-4 Advanced Video Coding (AVC),one picture is divided into macroblocks to encode an image. Then, therespective macroblocks are encoded using inter prediction or intraprediction.

In inter prediction, a motion estimation is used to eliminate temporalredundancy between consecutive pictures. To detect the temporalredundancy, one or more reference pictures are used to estimate motionof a current block, and a motion compensation is performed to generate aprediction block using motion information. A block very similar to anoriginal block is searched in a predetermine range of the referencepicture. If a block similar to an original block is searched, a residualblock between the original block and the prediction block and motioninformation are transmitted to enhance the coding efficiency.

Also, a motion vector predictor is generated using motion vectors ofneighboring block, and the difference between the motion vector and themotion vector predictor is encoded to reduce the amount of coding bitsrequired to encode the motion vector.

In H.264, the motion vector predictor is determined as a median of aleft motion vector, an above motion vector and an above left motionvector. But, if a motion of the current block is different motions ofthe neighboring blocks, the coding efficiency of the motion vectordegrades. Also, a new method of encoding a motion vector is requiredwhen the motion of image is little or steady or the image to be encodedis a background image.

SUMMARY OF THE DISCLOSURE

The present invention is directed to a method of encoding a motionvector of a current prediction unit using one of motion vectors ofspatially and temporally neighboring prediction unit and encoding amoving picture in inter prediction mode.

One aspect of the present invention provides a method of decoding amoving picture in intra prediction mode, comprising: determining areference picture index and a motion vector of a current predictionunit, deriving spatial motion vector candidates using valid motionvectors of neighboring prediction units each of which exists at apredetermined position, deriving temporal motion vector candidate of thecurrent prediction unit, determining one of the spatial and temporalmotions vector candidates as a motion vector predictor, calculating amotion vector difference between the motion vector of the currentprediction unit and the motion vector predictor and encoding the motionvector difference and the reference picture index.

A method according to the present invention determines a referencepicture index and a motion vector of a current prediction unit, derivesspatial motion vector candidates using valid motion vectors ofneighboring prediction units each of which exists at a predeterminedposition, derives temporal motion vector candidate of the currentprediction unit, determines one of the spatial and temporal motionsvector candidates as a motion vector predictor, calculates a motionvector difference between the motion vector of the current predictionunit and the motion vector predictor and encodes the motion vectordifference and the reference picture index. Thus, a motion vector iseffectively predicted in any kinds of image.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of a moving picture coding apparatus accordingto the present invention.

FIG. 2 is a block diagram of a moving picture decoding apparatusaccording to the present invention.

FIG. 3 is a flow chart illustrating a procedure of generating areconstructed block of a skipped coding unit according to the presentinvention.

FIG. 4 is a conceptual diagram showing positions of spatial skipcandidate blocks according to the present invention.

FIG. 5 is a conceptual diagram showing the positions of prediction unitsadjacent to a current prediction unit used to derive a reference pictureindex for a temporal skip candidate according to the present invention.

FIG. 6 is a conceptual diagram illustrating positions of blocks in atemporal skip candidate picture corresponding to a current predictionunit according to the present invention.

FIG. 7 is a flow chart illustrating a procedure of generating areconstructed block when motion vector is predictively coded accordingto the present invention.

FIG. 8 is a conceptual diagram showing positions of neighboringprediction units used to generate motion vector candidates according tothe present invention.

DETAILED DESCRIPTION OF THE DISCLOSURE

Hereinafter, various embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.However, the present invention is not limited to the exemplaryembodiments disclosed below, but can be implemented in various types.Therefore, many other modifications and variations of the presentinvention are possible, and it is to be understood that within the scopeof the disclosed concept, the present invention may be practicedotherwise than as has been specifically described.

A picture is divided into a plurality of slices, and each slice isdivided into a plurality of largest coding units (LCUs). The position ofeach LCU is designated by an address indicator. The LCU may be a codingunit or may be divided into a plurality of coding units. The LCUcontains information indicating structure of coding units in the LCU.One more split flags are used to indicate the structure of coding unitsin the LCU.

Each coding units consists of one or more prediction units. Theprediction unit is a basic block for intra prediction or interprediction. A transform unit is used for transform coding. In intraprediction, the prediction unit contains one or more transform units. Ininter prediction, a transform unit may be comprised of one or moreprediction units. The maximum size of the prediction unit is defined ina sequence parameter set (SPS), and the transform unit has a form of arecursive quad tree. The maximum size of the prediction unit in intraprediction may be different from that of the prediction unit in interprediction. The maximum sizes of the prediction unit in intra predictionand inter prediction are contained the sequence parameter set.

FIG. 1 is a block diagram of a moving picture coding apparatus accordingto the present invention.

Referring to FIG. 1, a moving picture coding apparatus 100 according tothe present invention includes a picture division unit 110, a transformunit 120, a quantization unit 130, a scanning unit 131, an entropycoding unit 140, an intra prediction unit 150, an inter prediction unit160, an inverse quantization unit 135, an inverse transform unit 125, apost-processing unit 170, a picture storing unit 180, a subtracter 190and an adder 195.

The picture division unit 110 analyzes an input video signal to divideeach LCU of a picture into one or more coding units each of which has apredetermined size, determine prediction mode of each coding unit, anddetermines size of prediction unit per each coding unit. The picturedivision unit 110 sends the prediction unit to be encoded to the intraprediction unit 150 or the inter prediction unit 160 according to theprediction mode. Also, the picture division unit 110 sends theprediction units to be encoded to the subtracter 190.

The transform unit 120 transforms residual signals between an originalblock of a prediction unit and a prediction block generated by the intraprediction unit 150 or the inter prediction unit 160. The residual blockmay have a size of coding unit. The residual block may be divided intooptimal transform units and transformed. A transform matrix type may beadaptively determined according to a prediction mode and an intraprediction mode. The transform unit of the residual signals may betransformed by horizontal and vertical one-dimensional (1D) transformmatrices. In inter prediction, one predetermined transform matrix typeis applied. In intra prediction, there is a high possibility that theresidual signals will have vertical directivity when the intraprediction mode of the current prediction unit is horizontal. Thus, adiscrete cosine transform (DCT)-based integer matrix is applied to thevertical direction, and a discrete sine transform (DST) or KarhunenLoève transform (KLT)-based integer matrix is applied to the horizontaldirection. When the intra prediction mode is vertical, a DST orKLT-based integer matrix is applied to the vertical direction, and aDCT-based integer matrix is applied to the horizontal direction. Also,in intra prediction, the transform matrix may be adaptively determinedaccording to a size of the transform units.

The quantization unit 130 determines a quantization step size forquantizing transform coefficients of the residual block. Thequantization step size is determined on a coding unit having a sizeequal to or larger than a predetermined size. If a plurality of codingunits are included in the predetermined size, the quantization step sizeis determined on the predetermined size. Using the determinedquantization step size and a quantization matrix determined according toa prediction mode, the transform coefficients are quantized. Thequantization unit 130 may determine a quantization step size ofneighboring coding unit as a quantization step size predictor of thecurrent coding unit. For example, the quantization unit 130 maydetermine a quantization step size of a left coding unit as aquantization step size predictor. If the left coding unit isunavailable, the quantization step size of the previous coding unit inscan order is determined as the quantization step size predictor.Alternatively, a first available quantization step size is determined asthe quantization step size predictor when scanning in the order of aleft coding unit, above coding unit and a previous coding unit.

The quantized transform block is provided to the inverse quantizationunit 135 and the scanning unit 131.

The scanning unit 131 scans the quantized transform coefficients of thequantized transform block, thereby converting the quantized transformcoefficients into 1D quantized transform coefficients. A scan pattern isdetermined according to the intra prediction mode and the predictionmode. The scan pattern may also be determined according to the size ofthe transform unit.

The scanning unit 131 determines the quantized transform block into aplurality of subsets. If the size of the transform unit is larger than afirst reference size, the quantized transform block is divided into theplurality of subsets. The first reference size is 4×4 or 8×8.

The scanning unit 131 determines a scan pattern. In inter prediction, apredetermined scan pattern (for example, zigzag scan) is used. In intraprediction, the scan pattern is selected based on the intra predictionmode and the size of the transform unit. In non-directional intraprediction mode, a predetermined pattern is used. The non-directionalintra prediction mode is a DC mode or a planar mode.

In directional intra prediction mode, the predetermined scan pattern isused if the size of the transform unit is equal to or larger than apredetermined size, and a scan pattern is adaptively selected based onthe directional intra prediction mode if the size of the transform unitis smaller than the predetermined size. The predetermined size is 16×16.

If the size of the transform unit is smaller than the predeterminedsize, one of three scan patterns is used. The three scan patterns are afirst scan pattern (a predetermined scan), a second scan pattern (ahorizontal scan) and a third scan pattern (a vertical scan). In verticalintra prediction mode, the second scan pattern is applied because it ishighly probable that the non-zero coefficients exists in the horizontaldirection. In a predetermined number of directional intra predictionmodes closest to the vertical intra prediction mode, the second scanpattern is applied. In horizontal intra prediction mode, the third scanpattern is applied. In the predetermined number of directional intraprediction modes closest to the horizontal intra prediction mode, thethird scan pattern is applied. The predetermined number is 6 or 8.

The quantized transform coefficients are scanned in reverse direction.When the quantized transform coefficients are divided into a pluralityof subsets, same scan pattern is applied to the quantized transformcoefficients of each subset. The plurality of subsets consist of onemain subset and one or more residual subsets. The main subset is locatedat an upper left side and includes a DC coefficient. The one or moreresidual subsets cover region other than the main subset.

Zigzag scan may be applied to scan the subsets. The subsets may bescanned beginning with the main subset to the residual subsets in aforward direction, or can be scanned in a reverse direction. A scanpattern for scanning the subsets may be set the same as a scan patternfor scanning the quantized transform coefficients. In this case, thescan pattern for scanning the subsets is determined according to theintra prediction mode. An encoder transmits information capable ofindicating a position of the last non-zero quantized coefficient of thetransform unit to a decoder. The encoder also transmits informationcapable of indicating a position of the last non-zero quantizedcoefficient of each subset to the decoder.

The inverse quantization unit 135 inversely quantizes the quantizedtransform coefficients. The inverse transform unit 125 restores residualsignals of the spatial domain from the inversely quantized transformcoefficients. The adder 195 generates a reconstructed block by addingthe residual block reconstructed by the inverse transform unit 125 andthe prediction block from the intra prediction unit 150 or the interprediction unit 160.

The post-processing unit 170 performs a deblocking filtering process forremoving blocking artifact generated in a reconstructed picture, anadaptive offset application process for complementing a differencebetween the reconstructed picture and the original image per pixel, andan adaptive loop filter process for complementing a difference betweenthe reconstructed picture and the original image in a coding unit.

The deblocking filtering process may be applied to a boundary betweenprediction units having a predetermined size or more and betweentransform units. The predetermined size may be 8×8. The deblockingfiltering process includes a step of determining a boundary to befiltered, a step of determining boundary filtering strength to beapplied to the boundary, a step of determining whether or not to apply adeblocking filter, and a step of selecting a filter to be applied to theboundary when it is determined to apply the deblocking filter.

Whether or not to apply the deblocking filter is determined according toi) whether or not the boundary filtering strength is greater than 0 andii) whether or not a value indicating the difference between boundarypixels of P block and Q block is smaller than a first reference valuedetermined according to a quantization parameter.

Two or more filters may exist. When an absolute value of a differencebetween two pixels adjacent to the block boundary is equal to or largerthan a second reference value, a weak filter is selected. The secondreference value is determined by the quantization parameter and theboundary filtering strength.

The adaptive offset application process is intended to reduce adifference (distortion) between a pixel subjected to the deblockingfilter and the original pixel. A picture or slice may be divided into aplurality of offset regions, and an offset mode may be determined perthe offset region. There are four edge offset modes, two band offsetmodes and an offset non-application mode. According to each offset mode,pixels in each offset region are classified into a predetermined numberof classes, and offset corresponding to the classified class is added tothe pixel. In the case of an edge offset mode, a class of a currentpixel is determined by comparing the current pixel value with pixelvalues of two or more pixels adjacent to the current pixel.

The adaptive loop filter process may be performed on the basis of avalue obtained by comparing an original image and a reconstructed imageto which the deblocking filtering process or the adaptive offsetapplication process is applied. An adaptive loop filter (ALF) isdetected through one Laplacian activity value on the basis of a 4×4block. The determined ALF can be applied to all pixels included in a 4×4block or an 8×8 block. Whether or not to apply an ALF may be determinedaccording to coding units. A size and coefficients of a loop filter mayvary according to each coding unit. Information indicating whether ALFis applied to each coding unit, filter coefficient information andfilter shape information may be included in slice header and transmittedto the decoder. In the case of a chrominance signal, whether or not toapply the ALF may be determined in picture units. Unlike luminance, theloop filter may have a rectangular shape.

The adaptive loop filter process is performed on the basis of sequenceor picture. The ALF filter parameter information is included in pictureheader or slice header. If the ALF filter parameter information isincluded in a picture header, the slice header does not contain the ALFfilter parameter information. But, if the ALF filter parameterinformation is not included in the picture header, the slice headercontains the ALF filter parameter information. The ALF filter parameterinformation includes a horizontal length and/or a vertical length of thefilter for luminance components and a number of filters. If the numberof filter is 2 or more, the ALF filter parameter information may containinformation indicating whether the filters are encoded using predictionor not. The ALF filter parameter information includes the filtercoefficients encoded predictively when the filters are encoded usingprediction.

Chrominance components may also be filtered adaptively. The slice headeror the picture header may include information whether each chrominancecomponent is filtered or not. To reduce the amount of bits, theinformation indicating whether the Cr component is filtered andinformation indicating whether the Cb component is filtered may be codedjointly. A lowest index is assigned to the case that none of Cr and Cbcomponents are not filtered because the probability that none of Cr andCb components are not filtered is high. A highest index is assigned tothe case that the both of Cr and Cb components are filtered.

The picture storing unit 180 receives post-processed image from thepost-processing unit 170, and stores the image in picture units. Apicture may be a frame or a field. The picture storing unit 180 has abuffer (not shown) capable of storing a plurality of pictures.

The inter prediction unit 160 performs motion estimation using one ormore reference pictures stored in the picture storing unit 180, anddetermines one or more reference picture indexes indicating thereference pictures and one or more motion vectors. According to thereference picture index and motion vector, the inter prediction unit 160extracts a prediction block corresponding to a prediction unit to beencoded from a reference picture selected among a plurality of referencepictures stored in the picture storing unit 180 and outputs theextracted prediction block.

The intra prediction unit 150 performs intra prediction usingreconstructed reference pixels in a picture including a currentprediction unit. The intra prediction unit 150 receives the currentprediction unit to be predictively encoded, selects one of apredetermined number of intra prediction modes, and performs intraprediction. The predetermined number of intra prediction modes dependson a size of the current prediction unit. The intra prediction unit 150adaptively filters reference pixels to generate the intra predictionblock. When some of reference pixels are not available, it is possibleto generate the reference pixels at the invalid positions using validreference pixels.

The entropy coding unit 140 entropy-codes the quantized transformcoefficients from the quantization unit 130, intra predictioninformation received from the intra prediction unit 150, motioninformation received from the inter prediction unit 160, and so on.

Meanwhile, the apparatus 100 according to the present inventionpredictively encodes the motion vector. The encoding procedure of themotion vector is performed by the inter prediction unit 150 and theentropy coding unit 140. The encoding procedure of the motion vector isas follows.

First, a motion vector of the current prediction unit is obtained.Available motion vectors of neighboring prediction units existing atpredetermined positions are determined as spatial motion vectorcandidates. If the motion vector of neighboring prediction unit does notexist or the neighboring prediction unit is not included current slice,the motion vector is determined as unavailable.

Next, the spatial motion vector may be scaled adaptively. If the currentprediction unit and the neighboring prediction unit have same referencepicture, the motion vector candidate is not scaled. But, if the currentprediction unit and the neighboring prediction unit have differentreference pictures, or the temporal distances of the reference pictureare not same, the motion vector candidate may be scaled using thetemporal distances. The motion vector may not be scaled for a stillimage or background image. The number of scaling of the spatial motionvector candidate may be limited to a predetermined number.

A motion vector predictor is selected among the spatial motion vectorcandidates and the temporal motion vector candidate. Then the motionvector difference (MVD) between the motion vector of the currentprediction unit and the motion vector predictor is obtained and encoded.

The temporal motion vector candidate is a motion vector of a block whichis located at or nearby a position in one reference picturecorresponding to the position of the current prediction unit. When thereexist a plurality of blocks in the reference picture, one motion vectoris selected as a temporal motion vector according to a predeterminedmethod. For example, when two blocks are considered, if the motionvector of the block located at a first position is available, the motionvector is determined as the temporal motion vector candidate. But, ifthe motion vector of the block located at the first position isunavailable, the motion vector of a block located at a second positionis determined as the temporal motion vector candidate.

In B slice, the reference picture containing the temporal motion vectorcandidate is derived reference picture list 0 or 1. Therefore, the listindicator indicating one reference picture list is transmitted to adecoder, and the decoder determines the reference picture containing thetemporal motion vector candidate using the list indicator.

Information indicating whether the temporal motion vector candidate isused or not is included in the bit stream. Therefore, the decodingprocedure of the motion vector may vary according to the information.

The spatial motion vector candidates are a left motion vector candidateand an above motion vector candidate. The left motion vector candidateis a motion vector of a left prediction unit or a motion vector of aleft below prediction unit. The left motion vector candidate is a firstvalid motion vector encountered when retrieving the motion vectors ofthe left prediction unit and the left below prediction unit in apredetermined order. The above motion vector candidate is a first validmotion vector encountered when retrieving the motion vectors of an aboveprediction unit, an above right prediction unit and an above leftprediction unit in a predetermined order.

If motion vector candidates have the same motion vectors, the motionvector candidate having large order is eliminated. If the motion vectorcandidate is one, the motion vector candidate is determined as motionvector predictor, and the predictor indicator indicting the motionvector predictor is not encoded.

FIG. 2 is a block diagram of a moving picture decoding apparatusaccording to the present invention.

The moving picture decoding apparatus according to the present inventionincludes an entropy decoding unit 210, an inverse scanning unit 215, aninverse quantization unit 220, an inverse transform unit 225, an adder270, a post-processing unit 250, a picture storing unit 260, an intraprediction unit 230, an inter prediction unit 240 and a switch 285.

The entropy decoding unit 210 extracts intra prediction information,inter prediction information and quantized coefficients information froma received bit stream. The entropy decoding unit 210 transmits the interprediction information to the inter prediction unit 240, the intraprediction information to the intra prediction unit 230 and the inversetransform unit 225, and the quantized coefficients information to theinverse quantization unit 220 and the inverse transform unit 225.

The inverse scanning unit 215 converts the quantized coefficientsinformation into two dimensional quantized transform block. One of aplurality of inverse scan patterns is selected for the conversion. Theinverse scan pattern is selected based on the intra prediction mode. Ifa size of a transform unit to be decoded is larger than thepredetermined reference size, the quantized transform coefficients ofeach subset are inversely scanned according to the selected inverse scanpattern to generate a plurality of subsets and a quantized transformblock having a size of the transform unit is generated using theplurality of subsets. If the size of a transform unit to be decoded isequal to the predetermined reference size, the quantized transformcoefficients of the quantized transform block are inversely scannedaccording to the selected inverse scan pattern to generate the quantizedtransform block having a size of the transform unit. The plurality ofsubsets consist of one main subset and one or more residual subsets. Themain subset is positioned at an upper left side and includes a DCcoefficient, and the one or more residual subsets cover region otherthan the main subset. A scan pattern to be applied to the subsets may bea zigzag scan. The subsets may be inversely scanned beginning with themain subset to the residual subsets in a forward direction, or can bescanned in the reverse direction. A scan pattern for scanning thesubsets may be set the same as a scan pattern for scanning the quantizedtransform coefficients. The inverse scanning unit 215 performs inversescanning procedure using information indicating a position of the lastnon-zero quantized coefficient of the transform unit.

In a directional intra prediction mode, the inverse scan pattern forinversely scanning the quantized transform coefficient of each subset isdetermined based on the directional intra prediction mode and a size ofthe transform unit. For example, a predetermined inverse scan pattern isused if the size of the transform unit is equal to or larger than apredetermined size, and an inverse scan pattern is adaptively selectedbased on the directional intra prediction mode if the size of thetransform unit is smaller than the predetermined size. The predeterminedsize is 16×16.

If the size of the transform unit is smaller than the predeterminedsize, one of three inverse scan patterns is used. The three inverse scanpatterns are a first scan pattern (a predetermined scan), a second scanpattern (a horizontal scan) and a third scan pattern (a vertical scan).In vertical intra prediction mode, the second scan pattern is appliedbecause it is highly probable that the non-zero coefficients exist inthe horizontal direction. In a predetermined number of directional intraprediction modes closest to the vertical intra prediction mode, thesecond scan pattern is applied. In horizontal intra prediction mode, thethird scan pattern is applied. In the predetermined number ofdirectional intra prediction modes closest to the horizontal intraprediction mode, the third scan pattern is applied. The predeterminednumber is 6 or 8.

The inverse quantization unit 220 generates a quantization step sizepredictor of a current coding unit. The quantization step size isdetermined on a coding unit having a size equal to or larger than apredetermined size. If a plurality of coding units are included in thepredetermined size, the quantization step size is determined for thepredetermined size. Using the determined quantization step size and aquantization matrix determined according to the prediction mode, thetransform coefficients are quantized. The inverse quantization unit 220may determine a quantization step size of neighboring coding unit as aquantization step size predictor of the current coding unit. Forexample, the inverse quantization unit 220 may determine thequantization step size of a left coding unit as the quantization stepsize predictor. If the left coding unit is unavailable, the quantizationstep size of the previous coding unit in scan order is determined as thequantization step size predictor. Alternatively, a first availablequantization step size is determined as the quantization step sizepredictor when scanning in the order of a left coding unit, above codingunit and a previous coding unit.

When the quantization step size predictor is determined, thequantization step size is obtained by adding the quantization step sizepredictor and the received residual quantization step size. Then, thequantized transform coefficients are inversely quantized using thequantization step size and a prediction mode.

The inverse transform unit 225 inversely transforms the inversequantized block to restore a residual block. The inverse transformmatrix to be applied to the inverse quantized block is adaptivelydetermined according to the prediction mode and the intra predictionmode. The determination procedure of the inverse transform matrix is thesame as the procedure in the transform unit 120 of FIG. 1.

The adder 270 adds the restored residual block and a prediction blockgenerated by the intra prediction unit 230 or the inter prediction unit240 to generate a reconstructed block.

The post-processing unit 250 applies a de-blocking filter on thereconstructed image to reduce blocking artifacts resulted from thequantization.

The picture storing unit 260 stores a reconstructed picture filtered bythe post-processing unit 250.

The intra prediction unit 230 restores the intra prediction mode of thecurrent block based on the received intra prediction information, andgenerates a prediction block according to the restored intra predictionmode.

The inter prediction unit 240 restores reference picture indexes andmotion vectors based on the received inter prediction information, andgenerates a prediction block using the reference picture indexes and themotion vectors. When the motion vector does not indicate a pixelposition, the prediction block is generated using an interpolationfilter. The inter prediction unit 240 decodes a motion vector asfollows.

The inter prediction unit 240 decodes the encoded motion vectordifference to generate.

Available motion vectors of neighboring prediction units existing atpredetermined positions are determined as spatial motion vectorcandidates. If the current prediction unit and the neighboringprediction unit have same reference picture, the motion vector candidateis not scaled. But, if the current prediction unit and the neighboringprediction unit have different reference pictures, or the temporaldistances of the reference picture are not same, the motion vectorcandidate may be scaled using the temporal distances.

A motion vector predictor is selected among the spatial motion vectorcandidates and the temporal motion vector candidate using informationindicting motion vector predictor. Then the motion vector difference andthe motion vector predictor are added to generate a motion vector of thecurrent prediction unit.

The temporal motion vector candidate is a motion vector of theprediction unit which exists at a position or nearby the positioncorresponding to the position of the current prediction unit. When thereexist a plurality of prediction units in the reference picture, onemotion vector is selected as a temporal motion vector according to apredetermined method. For example, when there exist two predictionunits, if a motion vector of the prediction unit of a first position isavailable, the motion vector is determined as the temporal motion vectorcandidate. But, if a motion vector of the prediction unit of a firstposition is unavailable, the motion vector of the prediction unit of thesecond position is determined as the temporal motion vector candidate.

In B slice, the reference picture containing the temporal motion vectorcandidate is derived reference picture list 0 or 1. Therefore, the listindicator indicating one reference picture list is used to determine thereference picture containing the temporal motion vector candidate.

The information indicating whether the temporal motion vector candidateis used or not is included in the bit stream. Therefore, the decodingprocedure of the motion vector may vary according to the information.

The spatial motion vector candidates are a left motion vector candidateand an above motion vector candidate. The left motion vector candidateis a motion vector of a left prediction unit or a motion vector of aleft below prediction unit. The left motion vector candidate is a firstvalid motion vector encountered when retrieving the motion vectors ofthe left prediction unit and the left below prediction unit in apredetermined order. The above motion vector candidate is a first validmotion vector encountered when retrieving the motion vectors of an aboveprediction unit, an above right prediction unit and an above leftprediction unit in a predetermined order.

The switch 285 transmits a prediction block generated by the intraprediction unit 230 or a prediction block generated by the interprediction unit 240 to the adder 270 based on the prediction mode.

A method of decoding a moving image in inter prediction mode isdescribed. The method comprises a procedure of decoding motioninformation of the current prediction unit, a procedure of generating aprediction block of the current prediction unit, a procedure ofrestoring a residual block and a procedure of generating a reconstructedblock using the prediction block and the residual block. The motioninformation includes motion vectors and reference picture indexes.

FIG. 3 is a flow chart illustrating a procedure of generating areconstructed block of a skipped coding unit according to the presentinvention. When the skip_flag of the received coding unit is 1, theprocedure is performed.

First, spatial skip candidates are derived from neighboring predictionunits (S210).

FIG. 4 is a conceptual diagram showing positions of spatial skipcandidate blocks according to the present invention.

As shown in FIG. 4, a left prediction unit (block A), an aboveprediction unit (block B), an above right prediction unit (block C) anda left below prediction unit (block D) may be the spatial skipcandidates. An above left prediction unit (block E) can be a spatialskip candidate block if one or more blocks among the blocks A, B, C andD are unavailable. The block is unavailable if the motion vector of theblock is not available. The skip candidate is the information of theskip candidate block.

Alternatively, a left prediction unit (block A), an above predictionunit (block B) and a corner prediction unit may be the spatial skipcandidate blocks. The corner prediction unit is a first availableprediction unit encountered when retrieving the blocks C, D and E in apredetermined order.

The availability is checked on each neighboring prediction unit. If theprediction unit does not exist or the prediction mode of the predictionunit is the intra mode, the prediction unit is determined asunavailable.

When there are a plurality of left prediction units, a first availableprediction unit encountered when retrieving the plurality of leftprediction units in a predetermined order (for example, from top tobottom or from bottom to top) may be determined as the left predictionunit, or an uppermost left prediction unit or a lowest left predictionunit may be determined as the left prediction unit.

When there are a plurality of above prediction units, a first availableprediction unit encountered when retrieving the plurality of aboveprediction units in a predetermined order (for example, from left toright or from right to left) may be determined as the above predictionunit, or a leftmost above prediction unit or a rightmost aboveprediction unit may be determined as the above prediction unit.

The temporal skip candidate is derived (S220). The step S220 comprises astep for deriving reference picture index for temporal skip candidateand a step for deriving motion vector of the temporal skip candidate.

The step for deriving reference picture index for temporal skipcandidate is as follows. The reference picture index for temporal skipcandidate may be set to 0. Or the reference picture index may be derivedusing reference picture indexes of spatially neighboring predictionunits.

FIG. 5 is a conceptual diagram showing the positions of prediction unitsadjacent to a current prediction unit used to derive a reference pictureindex for a temporal skip candidate according to the present invention.The reference picture index for temporal skip candidate is one of thereference picture indexes of the neighboring prediction units.

The reference picture indexes of a left prediction unit (block A), anabove prediction unit (block B), an above right prediction unit (blockC), a below left prediction unit (block D) and an above right block(block E) may be used to derive the reference picture index for temporalskip candidate.

When there are a plurality of above prediction units, a first availableprediction unit encountered when retrieving the plurality of aboveprediction units from left to right or from right to left may bedetermined as the above prediction unit. When there are a plurality ofleft prediction units, a first available prediction unit encounteredwhen retrieving the plurality of left prediction units from top tobottom may be determined as the left prediction unit.

A reference picture index of a corner prediction unit is a referencepicture index of a first available prediction unit encountered whenretrieving the blocks in the order of C, D and E.

When the reference picture index of the left neighboring prediction unit(left reference picture index), the reference picture index of the aboveneighboring prediction unit (above reference picture index) and thereference picture index of the corner neighboring prediction unit(corner reference picture index), the reference picture index fortemporal skip candidate is derived from these. Here, the only one of theblocks C, D and E is used to derive the reference picture index fortemporal skip candidate. But, blocks C and D or all of the blocks C, Dand E may be used to derive the reference picture index for temporalskip candidate.

The reference picture index of the highest frequency is determined asthe reference picture index for temporal skip candidate. When there area plurality of the reference picture indexes having same frequency, thelowest reference picture index is determined as the reference pictureindex for temporal skip candidate.

The step for deriving motion vector for a temporal skip candidate is asfollows.

First, a reference picture which a temporal skip candidate block belongsto (a temporal skip candidate picture) is derived. For example, areference picture of index 0 may be determined as the temporal skipcandidate picture. A first reference picture of the reference picturelist 0 is determined as the temporal skip candidate picture when theslice type is P. When the slice type is B, one reference picture list isselected using a flag of slice header indicating the temporal skipcandidate picture and a first reference picture of the selectedreference picture list is determined as the temporal skip candidatepicture.

Alternatively, a reference picture indicated by a reference pictureindex for temporal skip candidate picture is determined as the temporalskip candidate picture which the temporal skip candidate block belongsto. For example, the reference picture indicated by the referencepicture index for temporal skip candidate picture is determined as thetemporal skip candidate picture when the slice type is P. When the slicetype is B, the reference picture list is selected using the flagindicating the temporal skip candidate picture and the reference pictureindicated by the reference picture index for temporal skip candidatepicture is determined as the temporal skip candidate picture.

Next, a temporal skip candidate block is derived. One of a plurality ofblocks corresponding to the current prediction unit is selected as thetemporal skip candidate block. The plurality of blocks are locatedwithin the temporal skip candidate picture. A priority is assigned toeach of the plurality of blocks. A first available block determinedbased on the priorities is selected as the temporal skip candidateblock.

FIG. 6 is a conceptual diagram illustrating positions of blocks in atemporal skip candidate picture corresponding to a current predictionunit according to the present invention.

It is preferred that a position of temporal skip candidate block isdifferent from positions of spatial skip candidate blocks.

Thus, a below right corner block (block BR0) or a lower right block(block BR1) may be a first skip candidate block. The below right cornerblock (block BR0) is adjacent to a block which is included in thetemporal skip candidate picture and corresponds to the currentprediction unit. The lower right block (block BR1) is located inside ofa block which is included in the temporal skip candidate picture andcorresponds to the current prediction unit. A block (block C) includingan upper left pixel or a below left pixel of the center position of ablock which is included in the temporal skip candidate picture andcorresponds to the current prediction unit may be a second skipcandidate block.

If the first skip candidate block is available, the first skip candidateblock is determined as the temporal skip candidate block. If the firstskip candidate block is not available and the second skip candidateblock is available, the second skip candidate block is determined as thetemporal skip candidate block.

Alternatively, a first available block encountered when retrieving theblocks in the order of BR0, BR1 and C may be determined as the temporalskip candidate block. Or a largest block may be determined as thetemporal skip candidate block or a median value may be determined as atemporal skip candidate motion vector when there are a plurality ofcorresponding blocks.

When the temporal skip candidate block is determined, a motion vector ofthe temporal skip candidate block is set as the temporal skip candidatemotion vector.

Next, a skip candidate list is constructed (S230).

The skip candidate list is constructed using available spatial andtemporal skip candidates. The skip candidate list may be constructed inthe order of a spatial left skip candidate (candidate A), a spatialabove skip candidate (candidate B), a temporal skip candidate, a spatialabove right skip candidate (candidate C) and a spatial below left skipcandidate (candidate D), or in the order of a temporal skip candidate, aspatial left skip candidate (candidate A), a spatial above skipcandidate (candidate B), a spatial above right skip candidate (candidateC) and a spatial below left skip candidate (candidate D).

When one or more of the candidates A, B, C, D are not available, aspatial above left skip candidate (candidate E) is added to the positionof the unavailable candidate in the skip candidate list.

If a plurality of candidates have same motion information, the candidatehaving lower priority is deleted in the skip candidate list. The motioninformation includes motion vector and reference picture index.

Next, the motion vector and the reference picture index of the currentprediction unit are derived (S240).

When there is a skip index in the received prediction unit, the motionvector and the reference picture index of the skip candidate indicatedby the skip index are determined as the motion vector and the referenceindex of the current prediction unit.

When there is not a skip index in the received prediction unit and thereexists a skip candidate, the motion vector and the reference pictureindex of the skip candidate are determined as the motion vector and thereference index of the current prediction unit.

When there is not a skip index in the received prediction unit and theredoes not exist at least one skip candidate, the motion vector and thereference index of the current prediction unit are set to 0.

When the skip index indicates the temporal skip candidate, the motionvector of the skip candidate block is determined as the motion vector ofthe current prediction unit and 0 or the reference picture index for thetemporal skip candidate is determined as the reference picture index ofthe current prediction unit.

The skip index may have been coded using a VLC table determined by thenumber of the available skip candidates. If the skip index has beencoded using a VLC table determined by the number of the available skipcandidates, a step for counting the number of the available skipcandidates and decoding the skip index using a VLC table correspondingto the number may be inserted between the steps 230 and 240.Alternatively, the number of skip candidates may be fixed. If the numberof skip candidates is fixed, one or more additional skip candidates maybe generated to be added the skip candidate list.

If the motion vector and the reference picture index are derived, aprediction block is generated using the reference picture index andmotion vector (S250). The prediction block is a reconstructed block.

Meanwhile, a procedure of generating a reconstructed block performedwhen the skip_flag in the coding unit syntax is 0 and merge_flag in theprediction unit syntax is 1 is almost same as the procedure ofgenerating a reconstructed block of a skipped coding unit. Specifically,the procedure of generating a prediction block is same as the procedureof generating a prediction block of a skipped coding unit. But, theresidual block is not zero in the merge mode, a step for restoring aresidual block and a step for generating a reconstructed block by addingthe prediction block and the residual block are added.

Valid Spatial and temporal merge candidates are derived. The spatialmerge candidates are the same as the spatial skip candidates. Thetemporal merge candidate is the same as the temporal skip candidate.

Next, a merge candidate list is constructed using valid mergecandidates. The merge candidate list may be constructed in apredetermined order. The predetermined order is the order of a spatialleft merge candidate (candidate A), a spatial above merge candidate(candidate B), a temporal merge candidate, a spatial above right mergecandidate (candidate C) and a spatial below left merge candidate(candidate D), or in the order of a temporal merge candidate, a spatialleft merge candidate (candidate A), a spatial above merge candidate(candidate B), a spatial above right merge candidate (candidate C) and aspatial below left merge candidate (candidate D).

When one or more of the candidates A, B, C, D are not available, aspatial above left merge candidate (candidate E) is added to theposition of the unavailable candidate in the merge candidate list.

Also, the predetermined order may be changed or one or more mergecandidates are excluded from the merge candidates according to aprediction mode of the prediction unit. For example, if the predictionunit is 2N×N, the spatial below left merge candidate (candidate D) maybe excluded. If the prediction unit is N×2N, the orders of the spatialbelow left merge candidate (candidate D) and the spatial upper rightmerge candidate (candidate C) are changed or the spatial upper rightmerge candidate (candidate C) is excluded.

Next, the motion vector and the reference picture index of the currentprediction unit are derived. When there is a merge index in the receivedprediction unit, the motion vector and the reference picture index ofthe merge candidate indicated by the merge index are determined as themotion vector and the reference index of the current prediction unit.

When there is not a merge index in the received prediction unit andthere exists a merge candidate, the motion vector and the referencepicture index of the merge candidate are determined as the motion vectorand the reference index of the current prediction unit.

When there is not a merge index in the received prediction unit andthere does not exist at least one merge candidate, the motion vector andthe reference index of the current prediction unit are set to 0.

When the merge index indicates the temporal merge candidate, the motionvector of the merge candidate block is determined as the motion vectorof the current prediction unit and 0 or the reference picture index forthe temporal merge candidate is determined as the reference pictureindex of the current prediction unit.

The merge index may have been coded using a VLC table determined by thenumber of the available merge candidates. If the merge index has beencoded using a VLC table determined by the number of the available mergecandidates, a step for counting the number of the available skipcandidates and decoding the skip index using a VLC table correspondingto the number may be inserted.

If the motion vector and the reference picture index are derived, aprediction block is generated using the reference picture index andmotion vector.

Also, a residual block is restored in the unit of transform units. Theresidual block is restored through entropy decoding, inverse scan,inverse quantization and inverse transform. The procedure is performedby the entropy decoding unit 210, the inverse scanning unit 215, theinverse quantization unit 220 and the inverse transform unit 225 of thedecoding apparatus of FIG. 2.

Finally, a reconstructed block is generated using the prediction blockand the residual block. The reconstructed block may be generated in theunit of coding units.

FIG. 7 is a flow chart illustrating a procedure of generating areconstructed block when motion vector is predictively coded accordingto the present invention. When the skip_flag is 0 and the merge_flag is0, this procedure is activated.

First, a reference picture index and a motion vector difference of acurrent prediction unit is obtained from a prediction unit syntax of thereceived bit stream (S310).

If slice type is B, inter prediction information is checked. If theinter prediction information indicates an uni-directional prediction(Pred_LC) using combined reference picture list, a reference picture isselected using the reference picture index among the reference picturesof the combined reference picture list (list_c), and the motion vectordifference is restored. If the inter prediction information indicates anuni-directional prediction (Pred_L0) using reference picture list 0, areference picture is selected using the reference picture index amongthe reference pictures of the reference picture list 0, and the motionvector difference is restored. If the inter prediction informationindicates an bi-directional prediction (Pred_Bi), each reference pictureis selected using each reference picture index among the referencepictures of each reference picture list, and each motion vectordifference for each reference picture is restored.

Next, spatial motion vector candidates are derived (S320). FIG. 8 is aconceptual diagram showing positions of neighboring prediction unitsused to generate motion vector candidates according to the presentinvention.

A spatial left motion vector candidate block may be one of leftprediction units (blocks A and D) of a current block. A spatial abovemotion vector candidate block may be one of above prediction units(blocks B, C and E) of the prediction unit.

A procedure for deriving a spatial left motion vector candidate is asfollows.

It is checked whether there is a prediction unit satisfying firstconditions when retrieving the left blocks in the order of blocks A andD or in the order of blocks D and A. The first conditions are 1) thereexists a prediction unit, 2) the prediction unit is inter-coded, 3) theprediction unit has same reference picture as that of the currentprediction unit and 4) the prediction unit has same reference picturelist as that of the current prediction unit. If there is a predictionunit satisfying the first conditions, the motion vector of theprediction unit is determined as the spatial left motion vectorcandidate. If not, it is checked whether there is a prediction unitsatisfying second conditions. The second conditions are 1) there existsa prediction unit, 2) the prediction unit is inter-coded, 3) theprediction unit has same reference picture as that of the currentprediction unit and 4) the prediction unit has different referencepicture list from that of the current prediction unit. If there is aprediction unit satisfying the second conditions, the motion vector ofthe prediction unit is determined as the spatial left motion vectorcandidate. If not, it is checked whether there is a prediction unitsatisfying third conditions. The third conditions are 1) there exists aprediction unit, 2) the prediction unit is inter-coded, 3) theprediction unit has different reference picture from that of the currentprediction unit and 4) the prediction unit has same reference picturelist as that of the current prediction unit. If there is a predictionunit satisfying the third conditions, the motion vector of theprediction unit is determined as the spatial left motion vectorcandidate. If not, it is checked whether there is a prediction unitsatisfying fourth conditions. The fourth conditions are 1) there existsa prediction unit, 2) the prediction unit is inter-coded, 3) theprediction unit has different reference picture from that of the currentprediction unit and 4) the prediction unit has different referencepicture list from that of the current prediction unit. If there is aprediction unit satisfying the third conditions, the motion vector ofthe prediction unit is determined as the spatial left motion vectorcandidate.

The motion vector of the prediction unit satisfying the first conditionsor the second conditions is not scaled. But, the motion vector of theprediction unit satisfying the first conditions or the second conditionsis scaled.

If there is not a prediction unit satisfying any one conditions, thespatial left motion vector candidate is unavailable.

A procedure for deriving a spatial above motion vector candidate is asfollows.

It is checked whether there is a prediction unit satisfying firstconditions when retrieving the above blocks in the order of blocks B, Cand E or in the order of blocks C, B and E. If there is a predictionunit satisfying the first conditions, the motion vector of theprediction unit is determined as the spatial above motion vectorcandidate. If not, it is checked whether there is a prediction unitsatisfying the second conditions. If there is a prediction unitsatisfying the second conditions, the motion vector of the predictionunit is determined as the spatial above motion vector candidate. If not,it is checked whether there is a prediction unit satisfying the thirdconditions. If there is a prediction unit satisfying the thirdconditions, the motion vector of the prediction unit is determined asthe spatial above motion vector candidate. If not, it is checked whetherthere is a prediction unit satisfying the fourth conditions. If there isa prediction unit satisfying the fourth conditions, the motion vector ofthe prediction unit is determined as the spatial above motion vectorcandidate.

The motion vector of the prediction unit satisfying the first conditionsor the second conditions is not scaled. But, the motion vector of theprediction unit satisfying the first conditions or the second conditionsis scaled.

If there is not a prediction unit satisfying any one conditions, thespatial above motion vector candidate is unavailable.

A temporal motion vector candidate is derived (S330).

First, a reference picture which a temporal motion vector candidateblock belongs to (a temporal skip candidate picture) is derived. Areference picture of index 0 may be determined as the temporal motionvector candidate picture. For example, a first reference picture of thereference picture list 0 is determined as the temporal motion vectorcandidate picture when the slice type is P. When the slice type is B,one reference picture list is selected using a flag of slice headerindicating the temporal motion vector candidate picture and a firstreference picture of the selected reference picture list is determinedas the temporal motion vector candidate picture. Alternatively, areference picture indicated by a reference picture index received from aprediction unit syntax is determined as the temporal motion vectorcandidate picture.

Next, a temporal motion vector candidate block is derived. The temporalmotion vector candidate block is the same as the temporal skip candidateblock. If the temporal motion vector candidate block is derived, themotion vector of the temporal motion vector candidate block isdetermined as the temporal motion vector candidate.

Next, a motion vector candidate list is constructed (S340). The motionvector candidate list is constructed using available spatial andtemporal motion vector candidates. The motion vector candidate list maybe constructed in a predetermined order. The predetermined order is theorder of a spatial left motion vector candidate, a spatial above motionvector candidate and a temporal motion vector candidate, or the order ofa temporal motion vector candidate, a spatial left motion vectorcandidate and a spatial above motion vector candidate.

The predetermined order may be changed or one or more motion vectorcandidates are excluded from the motion vector candidates according to aprediction mode of the prediction unit. For example, if the currentprediction unit is a lower 2N×N prediction unit, the motion vectorcandidate of the upper prediction unit may be excluded. If the currentprediction unit is a right N×2N prediction unit, the orders of thespatial above motion vector candidate and the spatial left motion vectorcandidate are changed or the spatial left motion vector candidate isdeleted from the list.

Alternatively, when a coding unit is divided into two 2N×N predictionunits, the motion information of the above 2N×N prediction unit may beencoded in merge mode. If the motion information of the above 2N×Nprediction unit may not be encoded in merge mode, the block D may bedeleted or blocks A and D are scanned in this order for the spatial leftmotion vector candidate. When a coding unit is divided into two N×2Nprediction units, same method is applied for the above motion vectorcandidate.

Next, if a plurality of candidates have same motion vector, thecandidate having lower priority is deleted in the motion vectorcandidate list.

Next, a motion vector predictor of the current prediction unit isobtained (S350).

When there is a motion vector index in the received prediction unitsyntax, the motion vector candidate indicated by the motion vector indexare determined as the motion vector predictor of the current predictionunit. When there is not a motion vector index in the received predictionunit syntax and there exists a motion vector candidate, the motionvector candidate is determined as the motion vector predictor of thecurrent prediction unit. When there does not exist at least one motionvector candidate, the motion vector candidate is set to 0.

Meanwhile, prior to construction of the motion vector candidate list,the motion vector index maybe read. In this case, the number of validmotion vector to be retrieved is determined by the motion vector index.The motion vector index may be encoded in a fixed length or in avariable length.

If the motion vector predictor is obtained, a motion vector of thecurrent prediction unit is generated by adding the motion vectordifference and the motion vector predictor (S360).

Next, a prediction block is generated using the received referencepicture index and the restored motion vector (S370).

Also, a residual block is restored in the unit of transform units(S380). The residual block is restored through entropy decoding, inversescan, inverse quantization and inverse transform. The procedure isperformed by the entropy decoding unit 210, the inverse scanning unit215, the inverse quantization unit 220 and the inverse transform unit225 of the decoding apparatus of FIG. 2.

Finally, a reconstructed block is generated using the prediction blockand the residual block (S390). The reconstructed block may be generatedin the unit of coding units.

While the invention has been shown and described with reference tocertain exemplary embodiments thereof, it will be understood by thoseskilled in the art that various changes in form and details may be madetherein without departing from the spirit and scope of the invention asdefined by the appended claims.

1. An apparatus for encoding a moving picture, comprising: a picturedivision unit configured to determine a size and a prediction mode ofeach coding block; an inter prediction unit configured to determine areference picture and a motion vector of a current block by performingmotion estimation and extract a prediction block corresponding to thecurrent block from the reference picture when the current block is codedin inter prediction mode; an intra prediction unit configured todetermine an intra prediction mode of a current block and generate theprediction block corresponding to the current block according to theintra prediction mode when the current block is coded in intraprediction mode; a transform unit configured to transform a residualblock obtained by calculating difference between the current block andthe prediction block to generate a transform block; a quantization unitconfigured to determine a quantization step size of a current codingunit and quantize the transform block using the quantization step sizeto generate a quantized transform block; a scanning unit configured toscan quantized transform coefficients of the quantized transform blockto generate one-dimensional (1D) quantized transform coefficients; andan entropy coding unit configured to entropy-code the 1D quantizedtransform coefficients, wherein the motion vector predictor is anavailable spatial motion vector candidate or an available temporalmotion vector candidate and the temporal motion vector candidate is anavailable motion vector encountered first when retrieving motion vectorsin the order of motion vector of a first predetermined position andmotion vector of a second predetermined position in a same referencepicture, wherein the quantization step size is encoded using aquantization step size predictor and the quantization step sizepredictor is generated using a quantization step size of a left codingblock of the current coding block and a quantization step size of anabove coding block of the current coding block, wherein, when thequantization step size of the left coding block of the current codingblock and the quantization step size of the above coding block of thecurrent coding block are unavailable, a quantization step size ofprevious coding block in scan order is selected as the quantization stepsize predictor of the current coding block, and wherein, when a size ofthe transform block is larger than 4×4, the quantized transformcoefficients of the quantized transform block are divided into aplurality of sub-blocks, and the plurality of sub-blocks are scannedaccording to a scan pattern determined by the intra prediction mode ofthe current block and the quantized transform coefficients of eachsub-block are scanned according to a scan pattern determined by theintra prediction mode of the current block, and wherein the scan patternfor scanning the plurality of sub-blocks is the same as the scan patternfor scanning the quantized transform coefficients of each sub-block. 2.The apparatus of claim 1, wherein the scanning unit scans the quantizedtransform coefficients of each sub-block and the plurality of sub-blocksin a reverse direction.